package com.deanlib.cabinet.data.model;


import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Dean on 2022/6/21
 */
public class Auth implements Parcelable {

    public String token;//token的值 唯一性 且为主键
    public Long userId;
    public String ip;//登录IP地址


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.token);
        dest.writeValue(this.userId);
        dest.writeString(this.ip);
    }

    public void readFromParcel(Parcel source) {
        this.token = source.readString();
        this.userId = (Long) source.readValue(Long.class.getClassLoader());
        this.ip = source.readString();
    }

    public Auth() {
    }

    protected Auth(Parcel in) {
        this.token = in.readString();
        this.userId = (Long) in.readValue(Long.class.getClassLoader());
        this.ip = in.readString();
    }

    public static final Parcelable.Creator<Auth> CREATOR = new Parcelable.Creator<Auth>() {
        @Override
        public Auth createFromParcel(Parcel source) {
            return new Auth(source);
        }

        @Override
        public Auth[] newArray(int size) {
            return new Auth[size];
        }
    };
}
